package com.bt.dmdb.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import org.hibernate.annotations.Type;
import org.joda.time.LocalDateTime;

import com.bt.dmdb.json.converter.JsonDateDeserializer;
import com.bt.dmdb.json.converter.JsonDateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Entity
@Table(name = "customer")
@SuppressWarnings("serial")
public class CustomerDetails implements java.io.Serializable {

	private Long id;
	private String nameOfEntityCustomer;
	private String tin;
	private String countryOfIssuance;
	private String countryOfIncorporation;
	private String lei;
	private String aggregateBalanceExpected;
	private String investmentIncomeAsRatioOfGrossIncome;
	private String assetsQuarterlyInvestmentIncome;
	private String incorporationDate;
	private String bankruptcyFilingDate;
	private String usOwnersShareDistribution;
	private String usOwnersShareValueInDollars;
	private String electronicAccountNumber;	
	private String passiveIncomeofEAG;
	private String grossIncomeofEAG;
	private String totalAssestsEntity;
	private String totalAssestsEag;
	private String chapter4status;
	
	private String status;
	private String fatcaStatus;
	private String auditLog;
	private String moreInfo;
	private String isInfoMissing;
	private String isDocMissing;	
	private LoginUser createdBy;
	private LoginUser updatedBy;
	
	private LocalDateTime creationDate;
	
	private LocalDateTime modificationDate;
	
	private Set<CustomerDocument> customerDocuments = new HashSet<CustomerDocument>(0);
	private Set<BusinessNature> businessNature = new HashSet<BusinessNature>(0);
	/*private Set<CustomerQuestion> customerQuestion = new HashSet<CustomerQuestion>(0);*/
	private Set<StocksDistribution> stocksDistribution = new HashSet<StocksDistribution>(0);
	private Set<Regulators> regulators = new HashSet<Regulators>(0);
	private Set<RestrictedDistributor> restrictedDistributor = new HashSet<RestrictedDistributor>(0);
	private Set<Market> market = new HashSet<Market>(0);
	private Set<SourceIncome> sourceIncome = new HashSet<SourceIncome>(0);
	private Set<EagPassiveIncome> eagPassiveIncome = new HashSet<EagPassiveIncome>(0);
	private Set<MemberStatus> memberStatus = new HashSet<MemberStatus>(0);
	private Set<Locations> locations = new HashSet<Locations>(0);
	private Set<Contact> contact = new HashSet<Contact>(0);
	
	public CustomerDetails() {
	}

	public CustomerDetails(Long id, String nameOfEntityCustomer, String tin,
			String countryOfIssuance, String countryOfIncorporation,
			String lei, String aggregateBalanceExpected,
			String investmentIncomeAsRatioOfGrossIncome,
			String assetsQuarterlyInvestmentIncome, String incorporationDate,
			String bankruptcyFilingDate, String usOwnersShareDistribution,
			String usOwnersShareValueInDollars, String electronicAccountNumber,
			String passiveIncomeofEAG, String grossIncomeofEAG,
			String totalAssestsEntity, String totalAssestsEag,
			String chapter4status, String status, String fatcaStatus,
			String auditLog, String moreInfo, String isInfoMissing,
			String isDocMissing, LoginUser createdBy, LoginUser updatedBy,
			LocalDateTime creationDate, LocalDateTime modificationDate,
			Set<CustomerDocument> customerDocuments,
			Set<BusinessNature> businessNature,
			/*,Set<CustomerQuestion> customerQuestion,*/
			Set<StocksDistribution> stocksDistribution,
			Set<Regulators> regulators,
			Set<RestrictedDistributor> restrictedDistributor,
			Set<Market> market, Set<SourceIncome> sourceIncome,
			Set<EagPassiveIncome> eagPassiveIncome,
			Set<MemberStatus> memberStatus, Set<Locations> locations,
			Set<Contact> contact
			) {
		super();
		this.id = id;
		this.nameOfEntityCustomer = nameOfEntityCustomer;
		this.tin = tin;
		this.countryOfIssuance = countryOfIssuance;
		this.countryOfIncorporation = countryOfIncorporation;
		this.lei = lei;
		this.aggregateBalanceExpected = aggregateBalanceExpected;
		this.investmentIncomeAsRatioOfGrossIncome = investmentIncomeAsRatioOfGrossIncome;
		this.assetsQuarterlyInvestmentIncome = assetsQuarterlyInvestmentIncome;
		this.incorporationDate = incorporationDate;
		this.bankruptcyFilingDate = bankruptcyFilingDate;
		this.usOwnersShareDistribution = usOwnersShareDistribution;
		this.usOwnersShareValueInDollars = usOwnersShareValueInDollars;
		this.electronicAccountNumber = electronicAccountNumber;
		this.passiveIncomeofEAG = passiveIncomeofEAG;
		this.grossIncomeofEAG = grossIncomeofEAG;
		this.totalAssestsEntity = totalAssestsEntity;
		this.totalAssestsEag = totalAssestsEag;
		this.chapter4status = chapter4status;
		this.status = status;
		this.fatcaStatus = fatcaStatus;
		this.auditLog = auditLog;
		this.moreInfo = moreInfo;
		this.isInfoMissing = isInfoMissing;
		this.isDocMissing = isDocMissing;
		this.createdBy = createdBy;
		this.updatedBy = updatedBy;
		this.creationDate = creationDate;
		this.modificationDate = modificationDate;
		this.businessNature = businessNature;
		this.customerDocuments = customerDocuments;
		/*this.customerQuestion = customerQuestion;*/
		this.stocksDistribution = stocksDistribution;
		this.regulators = regulators;
		this.restrictedDistributor = restrictedDistributor;
		this.market = market;
		this.sourceIncome = sourceIncome;
		this.eagPassiveIncome = eagPassiveIncome;
		this.memberStatus = memberStatus;
		this.locations = locations;
		
		this.contact = contact;
	}

	@Id
	@GeneratedValue(generator = "customerDetailsIG", strategy = GenerationType.TABLE)
	@TableGenerator(name = "customerDetailsIG", table = "jpa_sequences", pkColumnName = "name", pkColumnValue = "CustomerDetails", allocationSize = 10, valueColumnName = "next_hi_value")
	@Column(name = "id")
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "name_entity_customer")
	public String getNameOfEntityCustomer() {
		return nameOfEntityCustomer;
	}
	
	public void setNameOfEntityCustomer(String nameOfEntityCustomer) {
		this.nameOfEntityCustomer = nameOfEntityCustomer;
	}

	@Column(name = "tin")
	public String getTin() {
		return tin;
	}

	public void setTin(String tin) {
		this.tin = tin;
	}

	@Column(name = "country_of_issuance")
	public String getCountryOfIssuance() {
		return countryOfIssuance;
	}
	
	public void setCountryOfIssuance(String countryOfIssuance) {
		this.countryOfIssuance = countryOfIssuance;
	}

	@Column(name = "country_of_incorporation")
	public String getCountryOfIncorporation() {
		return countryOfIncorporation;
	}
	
	public void setCountryOfIncorporation(String countryOfIncorporation) {
		this.countryOfIncorporation = countryOfIncorporation;
	}

	@Column(name = "lei")
	public String getLei() {
		return lei;
	}
	
	public void setLei(String lei) {
		this.lei = lei;
	}
	
    @Column(name = "aggregate_balance_expected")
	public String getAggregateBalanceExpected() {
		return aggregateBalanceExpected;
	}
    
    public void setAggregateBalanceExpected(String aggregateBalanceExpected) {
		this.aggregateBalanceExpected = aggregateBalanceExpected;
	}

    @Column(name = "investment_income_as_ratio_of_grossincome")
	public String getInvestmentIncomeAsRatioOfGrossIncome() {
		return investmentIncomeAsRatioOfGrossIncome;
	}
    
    public void setInvestmentIncomeAsRatioOfGrossIncome(
			String investmentIncomeAsRatioOfGrossIncome) {
		this.investmentIncomeAsRatioOfGrossIncome = investmentIncomeAsRatioOfGrossIncome;
	}

    @Column(name = "assets_pledged_Quarterly_investment_income")
	public String getAssetsQuarterlyInvestmentIncome() {
		return assetsQuarterlyInvestmentIncome;
	}
    
    public void setAssetsQuarterlyInvestmentIncome(
			String assetsQuarterlyInvestmentIncome) {
		this.assetsQuarterlyInvestmentIncome = assetsQuarterlyInvestmentIncome;
	}


    @Column(name = "incorporation_date")
	public String getIncorporationDate() {
		return incorporationDate;
	}
    
    public void setIncorporationDate(String incorporationDate) {
		this.incorporationDate = incorporationDate;
	}

    @Column(name = "bankruptcy_filing_date")
	public String getBankruptcyFilingDate() {
		return bankruptcyFilingDate;
	}

    public void setBankruptcyFilingDate(String bankruptcyFilingDate) {
		this.bankruptcyFilingDate = bankruptcyFilingDate;
	}
    
    @Column(name = "us_owners_share_distribution")
	public String getUsOwnersShareDistribution() {
		return usOwnersShareDistribution;
	}
    
    public void setUsOwnersShareDistribution(String usOwnersShareDistribution) {
		this.usOwnersShareDistribution = usOwnersShareDistribution;
	}

    @Column(name = "us_owers_share_value_in_dollars")
	public String getUsOwnersShareValueInDollars() {
		return usOwnersShareValueInDollars;
	}

	public void setUsOwnersShareValueInDollars(String usOwnersShareValueInDollars) {
		this.usOwnersShareValueInDollars = usOwnersShareValueInDollars;
	}

    @Column(name = "electronic_account_number")
	public String getElectronicAccountNumber() {
		return electronicAccountNumber;
	}
    
    public void setElectronicAccountNumber(String electronicAccountNumber) {
		this.electronicAccountNumber = electronicAccountNumber;
	}

    @Column(name = "passive_income_eag")
	public String getPassiveIncomeofEAG() {
		return passiveIncomeofEAG;
	}

    @Column(name = "gross_income_eag")
	public String getGrossIncomeofEAG() {
		return grossIncomeofEAG;
	}
    
    @Column(name = "total_assets_entity")
	public String getTotalAssestsEntity() {
		return totalAssestsEntity;
	}

    @Column(name = "total_assets_eag")
	public String getTotalAssestsEag() {
		return totalAssestsEag;
	}

    @Column(name = "chapter4status")
	public String getChapter4status() {
		return chapter4status;
	}

    @Column(name = "status")
	public String getStatus() {
		return status;
	}

    @Column(name = "fatca_status")
	public String getFatcaStatus() {
		return fatcaStatus;
	}

    @Column(name = "audit_log")
	public String getAuditLog() {
		return auditLog;
	}

    @Column(name = "moreinfo")
	public String getMoreInfo() {
		return moreInfo;
	}

    @Column(name = "isInfoMissing")
	public String getIsInfoMissing() {
		return isInfoMissing;
	}

    @Column(name = "isDocMissing")
	public String getIsDocMissing() {
		return isDocMissing;
	}

    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "created_by")
	public LoginUser getCreatedBy() {
		return createdBy;
	}

    public void setCreatedBy(LoginUser createdBy) {
		this.createdBy = createdBy;
	}
    
    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "updated_by")
	public LoginUser getUpdatedBy() {
		return updatedBy;
	}
	
	public void setUpdatedBy(LoginUser updatedBy) {
		this.updatedBy = updatedBy;
	}
    
    @Column(name = "creation_date")
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
    @JsonSerialize(using = JsonDateSerializer.class)
    @JsonDeserialize(using = JsonDateDeserializer.class)
	public LocalDateTime getCreationDate() {
		return creationDate;
	}
    
    @Column(name = "modification_date")
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
    @JsonSerialize(using = JsonDateSerializer.class)
    @JsonDeserialize(using = JsonDateDeserializer.class)
	public LocalDateTime getModificationDate() {
		return modificationDate;
	}

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customer", cascade = CascadeType.ALL)
	public Set<CustomerDocument> getCustomerDocuments() {
		return customerDocuments;
	}
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<BusinessNature> getBusinessNature() {
		return businessNature;
	}
    
    public void setBusinessNature(Set<BusinessNature> businessNature) {
		this.businessNature = businessNature;
	}

    /*  @OneToMany(fetch = FetchType.LAZY, mappedBy = "customer", cascade = CascadeType.ALL)
	public Set<CustomerQuestion> getCustomerQuestion() {
		return customerQuestion;
	}*/

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<StocksDistribution> getStocksDistribution() {
		return stocksDistribution;
	}

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<Regulators> getRegulators() {
		return regulators;
	}

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<RestrictedDistributor> getRestrictedDistributor() {
		return restrictedDistributor;
	}

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<Market> getMarket() {
		return market;
	}

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<SourceIncome> getSourceIncome() {
		return sourceIncome;
	}

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<EagPassiveIncome> getEagPassiveIncome() {
		return eagPassiveIncome;
	}

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<MemberStatus> getMemberStatus() {
		return memberStatus;
	}

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerid", cascade = CascadeType.ALL)
	public Set<Locations> getLocations() {
		return locations;
	}

    

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customerId", cascade = CascadeType.ALL)
	public Set<Contact> getContact() {
		return contact;
	}

	public void setPassiveIncomeofEAG(String passiveIncomeofEAG) {
		this.passiveIncomeofEAG = passiveIncomeofEAG;
	}

	public void setGrossIncomeofEAG(String grossIncomeofEAG) {
		this.grossIncomeofEAG = grossIncomeofEAG;
	}

	public void setTotalAssestsEntity(String totalAssestsEntity) {
		this.totalAssestsEntity = totalAssestsEntity;
	}

	public void setTotalAssestsEag(String totalAssestsEag) {
		this.totalAssestsEag = totalAssestsEag;
	}

	public void setChapter4status(String chapter4status) {
		this.chapter4status = chapter4status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public void setFatcaStatus(String fatcaStatus) {
		this.fatcaStatus = fatcaStatus;
	}

	public void setAuditLog(String auditLog) {
		this.auditLog = auditLog;
	}

	public void setMoreInfo(String moreInfo) {
		this.moreInfo = moreInfo;
	}

	public void setIsInfoMissing(String isInfoMissing) {
		this.isInfoMissing = isInfoMissing;
	}

	public void setIsDocMissing(String isDocMissing) {
		this.isDocMissing = isDocMissing;
	}

	

	public void setCreationDate(LocalDateTime creationDate) {
		this.creationDate = creationDate;
	}

	public void setModificationDate(LocalDateTime modificationDate) {
		this.modificationDate = modificationDate;
	}

	public void setCustomerDocuments(Set<CustomerDocument> customerDocuments) {
		this.customerDocuments = customerDocuments;
	}

	/*public void setCustomerQuestion(Set<CustomerQuestion> customerQuestion) {
		this.customerQuestion = customerQuestion;
	}*/

	public void setStocksDistribution(Set<StocksDistribution> stocksDistribution) {
		this.stocksDistribution = stocksDistribution;
	}

	public void setRegulators(Set<Regulators> regulators) {
		this.regulators = regulators;
	}

	public void setRestrictedDistributor(
			Set<RestrictedDistributor> restrictedDistributor) {
		this.restrictedDistributor = restrictedDistributor;
	}

	public void setMarket(Set<Market> market) {
		this.market = market;
	}

	public void setSourceIncome(Set<SourceIncome> sourceIncome) {
		this.sourceIncome = sourceIncome;
	}

	public void setEagPassiveIncome(Set<EagPassiveIncome> eagPassiveIncome) {
		this.eagPassiveIncome = eagPassiveIncome;
	}

	public void setMemberStatus(Set<MemberStatus> memberStatus) {
		this.memberStatus = memberStatus;
	}

	public void setLocations(Set<Locations> locations) {
		this.locations = locations;
	}

	

	public void setContact(Set<Contact> contact) {
		this.contact = contact;
	}
	
}
